﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Call_Center_Gochi.DAL;
using Call_Center_Gochi.Sesion;
using Call_Center_Gochi.Cliente;
using Call_Center_Gochi.Reportes;

namespace Call_Center_Gochi
{
    public partial class Principal : Form
    {
        String[] Usuario;
        FCliente FC;
        Informe1 Inf1;
        Informe2 Inf2;
        public Principal()
        {
            InitializeComponent();  
        }

        public void CierredeForm(object sender, EventArgs e)
        {
            FC = null;
            Inf1 = null;
            Inf2 = null;
        }

        public void Principal_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            Login L = new Login();
            Usuario = L.Abrir();
            this.Text += " Usuario : " + Usuario[0];
            switch (Usuario[1])
            {
                case "Administrador":
                    this.Visible = true;
                    break;
                case "Usuario":
                    this.Visible = true;
                    break;
                case "Cerrar":
                    this.Close();
                    break;
            }
          
        }

        private void nuevoClienteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FC == null)
            {
                FC = new FCliente(Usuario[2]);
                FC.FormClosing += CierredeForm;
                FC.MdiParent = this;
                FC.Show();
            }
        }

        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void informeGestionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Inf1 == null)
            {
                Inf1 = new Informe1();
                Inf1.FormClosing += CierredeForm;
                Inf1.MdiParent = this;
                Inf1.Show();
            }
        }

        private void informeEventosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Inf2 == null)
            {
                Inf2 = new Informe2();
                Inf2.FormClosing += CierredeForm;
                Inf2.MdiParent = this;
                Inf2.Show();
            }
        }
    }
}
